// #ifdef APP-PLUS
let alibc = uni.requireNativePlugin("FFX-Alibc")
TAOBAOINITSDK();
let jdkpl = uni.requireNativePlugin("FFX-Kpl")
JINGDONGINITSDK();
// #endif
//初始化淘宝授权
function TAOBAOINITSDK() {
	return new Promise((resolve, reject) => {
		alibc.initSdk((e) => {
			console.log(e);
		});
	})
}
//判断淘宝是否授权
function TAOBAOISLOGIN() {
	return new Promise((resolve, reject) => {
		alibc.isLogin((e) => {
			resolve(e.data)
		});
	})
}
//淘宝去授权登录
function TAOBAOLOGIN() {
	return new Promise((resolve, reject) => {
		alibc.login((e) => {
			console.log(e)
		});
	})
}
//退出淘宝授权
function TAOBAOLOGOUT() {
	return new Promise((resolve, reject) => {
		alibc.logout((e) => {
			console.log(e)
		});
	})
}
//淘宝服务端授权带回调
function TAOBAOOPENAUTHURL() {
	return new Promise((resolve, reject) => {
		let url =
			"https://oauth.m.taobao.com/authorize?response_type=code&client_id=33604445&redirect_uri=https://zkmmax.com/api/Tripartite/MuchIntegralCallback"
		alibc.openAuthUrl({
			url: url
		}, (e) => {
			resolve(e)
		});
	})
}
//淘宝任意打开链接
function TAOBAOOPENBYURL(url) {
	return new Promise((resolve, reject) => {
		// let url = "https://detail.tmall.com/item.htm?id=590985646975"
		alibc.openByUrl({
			url: url
		}, (e) => {
			resolve(e);
		});
	})
}
//初始化京东
function JINGDONGINITSDK() {
	return new Promise((resolve, reject) => {
		jdkpl.initSdk((e) => {
			console.log(e);
		});
	})
}
//京东打开任意链接
function JOINGDONGOPENURL(url) {
	return new Promise((resolve, reject) => {
		jdkpl.openUrl({
			url: url
		}, (e) => {
			console.log(e);
		});
	})
}
export {
	TAOBAOINITSDK,
	TAOBAOISLOGIN,
	TAOBAOLOGIN,
	TAOBAOLOGOUT,
	TAOBAOOPENAUTHURL,
	TAOBAOOPENBYURL,
	JINGDONGINITSDK,
	JOINGDONGOPENURL
}
